package com.anlu.concurrent.ch5.bq;

import java.util.concurrent.DelayQueue;

/**
 * <p>
 * Description:TODO 详细描述
 * <p>
 * Copyright: 天津联想协同科技有限公司
 * <p>
 *
 * @author anlu
 * @date 2021/10/27 16:41
 */
public class FetchOrder implements Runnable{

    private DelayQueue<ItemVo<Order>> queue;
    public FetchOrder(DelayQueue<ItemVo<Order>> queue) {
        super();
        this.queue = queue;
    }
    @Override
    public void run() {
        while (true){
            try {
                ItemVo<Order> item = queue.take();
                Order order = (Order)item.getDate();
                System.out.println("get from queue:"+order.getOrderNo());
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
